package com.ly.controller;

import com.ly.entity.BankAccount;
import com.ly.service.AccountService;
import com.ly.service.DepositService;
import com.ly.service.impl.AccountServiceImpl;
import com.ly.service.impl.DepositServiceImpl;
import com.ly.utils.Menu;

import static com.ly.utils.IOUtil.getIntInput;

/**
 * Author: LiYao
 * CreateTime: 2025-03-11 20:12
 * Description:
 * Version: 1.0
 */
public class BusinessController {

    public void start(BankAccount account)
    {
        AccountService accountService = new AccountServiceImpl();
        DepositService depositService = new DepositServiceImpl();
        boolean isRunning = true;
        while (isRunning) {
            Menu.showUserMenu();
            int choice = getIntInput("请选择操作：");

            switch (choice) {
                case 0:
                    double balance = accountService.getBalance(account);
                    System.out.println("当前余额为：" + balance);
                    break;
                case 1:
                    depositService.deposit(account);
                    break;
                case 2:
                    //withdraw();
                    break;
                case 3:
                    //transfer();
                    break;
                case 4:
                    isRunning = false;
                    System.out.println("感谢使用，再见！");
                    break;
                default:
                    System.out.println("无效选项，请重新输入");
            }
        }


    }



}
